package com.mms.action.meetingroom;

import java.util.List;

import com.mms.dao.MeetingRoomManagementDao;
import com.mms.entity.MeetingRoom;
import com.opensymphony.xwork2.Action;

public class ModifyMeetingRoomAction implements Action{

	private int startPage;
	private List<MeetingRoom> meetingMessage;
	private int account;
	private String mr_name;
	private int mr_capacity;
	private int mr_state;
	private int mrID;
	private boolean modifyIsSuccess;
	
	public int getStartPage() {
		return startPage;
	}


	public void setStartPage(int startPage) {
		this.startPage = startPage;
	}


	public List<MeetingRoom> getMeetingMessage() {
		return meetingMessage;
	}


	public void setMeetingMessage(List<MeetingRoom> meetingMessage) {
		this.meetingMessage = meetingMessage;
	}


	public int getAccount() {
		return account;
	}


	public void setAccount(int account) {
		this.account = account;
	}


	public String getMr_name() {
		return mr_name;
	}


	public void setMr_name(String mr_name) {
		this.mr_name = mr_name;
	}


	public int getMr_capacity() {
		return mr_capacity;
	}


	public void setMr_capacity(int mr_capacity) {
		this.mr_capacity = mr_capacity;
	}


	public int getMr_state() {
		return mr_state;
	}


	public void setMr_state(int mr_state) {
		this.mr_state = mr_state;
	}


	public int getMrID() {
		return mrID;
	}


	public void setMrID(int mrID) {
		this.mrID = mrID;
	}


	public boolean isModifyIsSuccess() {
		return modifyIsSuccess;
	}


	public void setModifyIsSuccess(boolean modifyIsSuccess) {
		this.modifyIsSuccess = modifyIsSuccess;
	}


	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		MeetingRoomManagementDao pmd=new MeetingRoomManagementDao();
        MeetingRoom meetingroom=new MeetingRoom();
        meetingroom.setMrName(mr_name);
        meetingroom.setCapacity((short)mr_capacity);
        meetingroom.setState(mr_state);
        meetingroom.setMrId(mrID);
        if(pmd.ModifyMeetingRoom(meetingroom)){
        	modifyIsSuccess = true;
        }
        else{
        	modifyIsSuccess = false;
        }
        MeetingRoomManagementDao mrmt = new MeetingRoomManagementDao();
        meetingMessage = mrmt.getMeetingRooms(startPage);
        account = mrmt.getcount();
		return "success";
	}
}
